﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FrmMain;
using System.Media;

namespace medio
{
    public partial class Form2 : Form
    {
        

        public Form2()
        {
            
            InitializeComponent();
        }
        Dao dao = new Dao();
        private void Form2_Load(object sender, EventArgs e)
        {
            dataGridView1.DataSource = dao.GetTable("select * from singer", null);
            bindCbo();
        }

        private void bindCbo()
        {
            string sql = "select * from singer_type";
            comboBox1.DataSource = dao.GetTable(sql, null);
            comboBox1.DisplayMember = "singertype_name";
            comboBox1.ValueMember = "singertype_id";
        }
        static DataSet ds = new DataSet();
        private void button3_Click(object sender, EventArgs e)
        {
            DataTable table= dao.GetTable("select * from singer", null);
            table.TableName = "singer";
            if (ds.Tables["singer"] != null) {
                ds.Tables["singer"].Clear();
            }
            ds.Tables.Add(table);
           
        }
       
    }
}
